﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Core.Business;

namespace TicketManagement.Template
{
    public partial class uMenu : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["User"] != null)
            {
                String currentUrl = HttpContext.Current.Request.Url.AbsoluteUri;
                if (!currentUrl.Contains("Question"))
                {
                    UserBus userBus = new UserBus();
                    Core.Entity.User user = userBus.get((int)Session["User"]);
                    if (user.UserTypeId != 4)
                    {
                        // Redirect to Dashboard if the logged in user is a staff
                        Response.Redirect("/Home/Dashboard.aspx", true);
                    }
                }
            }
        }
    }
}